/**
 * Copyright 2014-2020  the original author or authors.
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.upb.webserver.common.returncode;

/**
 * A-BB-CCC A:error level. <br/>
 * 1:system exception <br/>
 * 2:business exception <br/>
 * B:project number <br/>
 * UPB-WebServer:09 <br/>
 * C: error code <br/>
 */
public class ConstantCode {

    /* return success */
    public static final RetCode SUCCESS = RetCode.mark(0, "success");

    /* system exception */
    public static final RetCode SYSTEM_EXCEPTION = RetCode.mark(109000, "system exception");
    public static final RetCode UNSUPPORTED_PASSWORD_SSH_ERROR = RetCode.mark(109001, "SSH password login not supported yet.");
    public static final RetCode ILLEGAL_PATH = RetCode.mark(109002, "illegal path");
    /**
     * Business exception.
     */
    /* param exception */
    public static final RetCode PARAM_EXCEPTION = RetCode.mark(309000, "param exception");
    public static final RetCode INCOMPLETE_PARAM = RetCode.mark(309001, "incomplete parameters");


    //[work order][start]
    public static final RetCode INVALID_WORK_ORDER_ID = RetCode.mark(209050, "invalid work order id");
    public static final RetCode SOME_ONE_HAVE_NOT_COMPLETED_WORK_ORDER = RetCode.mark(209051, "some one have not completed the work order");
    public static final RetCode NOT_SUPPORT_OPERATE = RetCode.mark(209052, "not support the operation");
    public static final RetCode CHAIN_DEPLOY_FAIL = RetCode.mark(209053, "chain deploy request not success");
    public static final RetCode APPLICATION_DEPLOY_FAIL = RetCode.mark(209054, "application deploy request not success");
    public static final RetCode REQUIRE_ALL_ORG_ADD_HOST = RetCode.mark(209055, "require all org to add host");
    public static final RetCode UPPER_LIMIT_EXCEEDED = RetCode.mark(209056, "upper limit exceeded");
    public static final RetCode HOST_IP_CANNOT_SAME = RetCode.mark(209057, "host ip cannot be the same for different org");
    //[work order][end]

    //[security auth][start]
    public static final RetCode USER_NOT_LOGGED_IN = RetCode.mark(209252, "user not logged in");
    public static final RetCode ACCESS_DENIED = RetCode.mark(209253, "access denied");
    public static final RetCode INVALID_ACCOUNT_NAME = RetCode.mark(209254, "invalid account name");
    public static final RetCode PASSWORD_ERROR = RetCode.mark(209255, "password error");
    public static final RetCode USE_HAS_BEAN_FROZEN = RetCode.mark(209256, "account has bean frozen");
    //[security auth][end]

    //[token][start]
    public static final RetCode INVALID_TOKEN = RetCode.mark(209301, "invalid token");
    public static final RetCode TOKEN_EXPIRE = RetCode.mark(209302, "token expire");
    //[end][start]

    //[account][start]
    public static final RetCode ACCOUNT_HAS_BEAN_IN_USED = RetCode.mark(209351, "account has been in use");
    public static final RetCode MOBILE_HAS_BEAN_IN_USED = RetCode.mark(209352, "mobile has been registered");
    public static final RetCode EMAIL_HAS_BEAN_IN_USED = RetCode.mark(209353, "email has been registered");
    public static final RetCode EMAIL_NOT_MATCH = RetCode.mark(209354, "email not match");
    public static final RetCode MOBILE_NOT_MATCH = RetCode.mark(209355, "mobile not match");
    public static final RetCode INVALID_DEVELOPER_ID = RetCode.mark(209356, "invalid developer id");
    public static final RetCode INVALID_CONTACT_PERSON_ID = RetCode.mark(209357, "invalid contact person id");
    public static final RetCode INVALID_COMPANY_ID = RetCode.mark(209358, "invalid company id");
    public static final RetCode INVALID_ACCOUNT_ID = RetCode.mark(209359, "invalid account id");
    public static final RetCode NEW_PWD_EQUALS_OLD = RetCode.mark(209360, "the new password cannot be same as old");
    public static final RetCode COMPANY_NAME_IN_USE = RetCode.mark(209361, "company name has bean in use");
    public static final RetCode ACCOUNT_HAD_BEAN_FREEZE = RetCode.mark(209362, "account had bean freeze");
    public static final RetCode CAN_NOT_MODIFY_DATA_OF_COMPANY = RetCode.mark(209363, "can't manipulate this company's data");

    //[account][end]

    //[organization][start]
    public static final RetCode REQUEST_STAT_RESOURCE_ERROR = RetCode.mark(209100, "request Stat fail for resource exception");
    public static final RetCode REQUEST_STAT_HTTP_ERROR = RetCode.mark(209101, "request Stat fail, please check Stat");
    public static final RetCode INVALID_ORG_ID = RetCode.mark(209102, "invalid org id");
    public static final RetCode ORG_ID_HAS_BEEN_USED = RetCode.mark(209103, "org id has been used");
    public static final RetCode INVALID_HOST_ID = RetCode.mark(209104, "invalid host id");
    public static final RetCode INVALID_MESSAGE_STATUS = RetCode.mark(209105, "invalid message status");
    public static final RetCode DUPLICATE_ORG_NAME = RetCode.mark(209106, "duplicate orgName");
    //[organization][end]

    //[check code ][start]
    public static final RetCode CHECK_CODE_NULL = RetCode.mark(209000, "checkCode is null");
    public static final RetCode INVALID_CHECK_CODE = RetCode.mark(209001, "invalid checkCode");
    public static final RetCode CHECK_CODE_EXPIRE = RetCode.mark(209002, "checkCode expire");
    public static final RetCode INVALID_SECURITY = RetCode.mark(209003, "invalid security");
    public static final RetCode INVALID_APPID = RetCode.mark(209004, "invalid appid");
    //[check code ][end]

    //[chain][start]
    public static final RetCode CHAIN_JSON_FORMAT_ERROR = RetCode.mark(209401, "unsupported chain parameter format");
    public static final RetCode CHAIN_NAME_HASH_BEAN_USE = RetCode.mark(209402, "the chain name has bean in use");
    public static final RetCode INVALID_CHAIN_ID = RetCode.mark(209403, "invalid chainId");
    public static final RetCode CHAIN_TYPE_NOT_SUPPORT = RetCode.mark(209404, "not support this chain type");
    public static final RetCode FRONT_LIST_IS_EMPTY = RetCode.mark(209405, "front list is empty");
    public static final RetCode NOT_FOUND_INPUT_HOST = RetCode.mark(209406, "host can not be null");
    //[chain][end]

    //[application][start]
    public static final RetCode APPLICATION_NAME_HASH_BEAN_USE = RetCode.mark(209451, "the application name has bean in use");
    public static final RetCode APPLICATION_ID_INVALID = RetCode.mark(209452, "invalid application id");
    public static final RetCode APPLICATION_DEPLOY_NOT_SUCCESS = RetCode.mark(209453, "application deploy not success");
    public static final RetCode INVALID_DEVELOPER_APP_MAP_ID = RetCode.mark(209454, "invalid key id");
    public static final RetCode FAIL_STORE_KEY_FILE = RetCode.mark(209455, "store key file not success");
    public static final RetCode NODE_FOUND_NODE_OF_OBSERVER_OR_REMOVE = RetCode.mark(209456, "cannot find a node of type observer or remove");
    public static final RetCode NODE_FOUND_NODE_OF_OBSERVER_OR_SEALER = RetCode.mark(209457, "cannot find a node of type observer or observer");
    public static final RetCode ORG_HAS_NOT_JOIN_APPLICATION = RetCode.mark(209458, "org has not join application");
    public static final RetCode PASSWORD_BASE64_EMPTY = RetCode.mark(209459, "passwordBase64 is empty");
    //[application][end]

    //[restful][start]
    public static final RetCode REST_SERVER_ADDRESS_NOT_CONFIG = RetCode.mark(209201, "rest server address not config");
    public static final RetCode REST_SERVER_IP_PORT_FORMAT_ERROR = RetCode.mark(209202, "server ip port format error");
    public static final RetCode NOT_FOUND_REMOTE_SERVER = RetCode.mark(209203, "not found remote server");
    public static final RetCode REMOTE_SERVER_REQUEST_FAIL = RetCode.mark(209204, "remote server request fail");
    public static final RetCode TRANSFER_FILES_ERROR = RetCode.mark(209205, "transfer files unsuccessfully.");
    public static final RetCode DATA_SERVER_REQUEST_FAIL = RetCode.mark(209206, "data server request fail");
    //[restful][end]

    //[contract][start]
    public static final RetCode DUPLICATE_CONTRACT_NAME = RetCode.mark(209651, "duplicate contract name");
    public static final RetCode CONTRACT_ID_INVALID = RetCode.mark(209652, "invalid contract id");
    public static final RetCode CONTRACT_SAVE_NOT_SUCCESS = RetCode.mark(209653, "contract save not success");
    public static final RetCode PLATFORM_NOT_SUPPORT = RetCode.mark(209654, "not support request from the platform");
    public static final RetCode CONTRACT_DEPLOY_FAIL = RetCode.mark(209655, "contract deploy fail");
    public static final RetCode CHAIN_CODE_INSTALL_FAIL = RetCode.mark(209656, "chaincode install fail");
    public static final RetCode CHAIN_CODE_INIT_FAIL = RetCode.mark(209657, "chaincode instantiate fail");
    public static final RetCode CONTRACT_HAS_BEAN_DEPLOY = RetCode.mark(209658, "contract has bean deploy");
    public static final RetCode CONTRACT_HAS_NOT_BEAN_DEPLOY = RetCode.mark(209659, "contract has not bean deploy");
    public static final RetCode READ_FLE_NOT_SUCCESS = RetCode.mark(209660, "read file not success");
    //[contract][end]

    //[user][start]
    public static final RetCode USER_NAME_HAD_BEAN_IN_USE = RetCode.mark(209750, "the user name has bean in use");
    public static final RetCode INVALID_USER_ID = RetCode.mark(209751, "invalid user id");
    //[user][end]

    //[config][start]
    public static final RetCode CONFIG_NAME_AND_TYPE_HAD_EXIST = RetCode.mark(209701, "found record by name and type");
    public static final RetCode CONFIG_ID_INVALID = RetCode.mark(209702, "invalid config id");
    public static final RetCode NOT_FOUND_ADDRESS_CONFIG = RetCode.mark(209703, "not found address config");
    public static final RetCode SSH_KEY_HAS_EXIST = RetCode.mark(209704, "ssh key has exist");
    public static final RetCode HOST_HAD_BEAN_IN_USE = RetCode.mark(209705, "the host has bean in use");
    //[config][end]


    //[host][start]
    public static final RetCode IP_CONNECT_NOT_SUCCESS = RetCode.mark(209151, "ip connect not success");
    public static final RetCode DOCKER_COMMAND_NOT_FOUND = RetCode.mark(209152, "not found docker in the host");
    public static final RetCode INVALID_ORG_ID_OF_FRONT = RetCode.mark(209153, "front must belong to a valid org");
    public static final RetCode HOST_CHECK_NOT_SUCCESS = RetCode.mark(209154, "host check not success");
    public static final RetCode PORT_HAS_BEAN_IN_USE = RetCode.mark(209155, "port has bean in use");
    public static final RetCode TOO_MANY_NODE_COUNT = RetCode.mark(209156, "too many node count");
    public static final RetCode FOUND_RECORD_BY_ORG_AND_IP = RetCode.mark(209157, "found record by org and ip");
    //[host][end]

    //[keyword][start]
    public static final RetCode KEYWORD_ID_NOT_EXISTS = RetCode.mark(209821, "keyword id not exists");
    public static final RetCode KEYWORD_EXISTS = RetCode.mark(209822, "keyword exists");
    public static final RetCode SAVE_KEYWORD_FAIL = RetCode.mark(209823, "save keyword fail");
    //[keyword][end]

    //[audit][start]
    public static final RetCode AUDIT_ID_NOT_EXISTS = RetCode.mark(210841, "audit id not exists");
    public static final RetCode AUDIT_EXISTS = RetCode.mark(210842, "audit info exists");
    public static final RetCode SAVE_AUDIT_FAIL = RetCode.mark(210843, "save audit info fail");
    public static final RetCode INVALID_AUDIT_TYPE = RetCode.mark(210844, "invalid audit type");
    public static final RetCode KEYWORD_ID_EMPTY = RetCode.mark(210845, "keyword can not be empty");
    //[audit][end]


    //[cross][start]
    public static final RetCode CROSS_NAME_IN_USE = RetCode.mark(22000, "cross chain name has bean in use");
}
